home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1999 November
/
Macworld (1999-11).dmg
/
Updaters
/
WhiteCap 3.0.4
/
WhiteCap Source.sit
/
WhiteCap Source
/
Common
/
io
/
CEgOStream.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1999-07-13
|
2KB
|
124 lines
#include "CEgOStream.h"
#include "CEgIStream.h"
CEgOStream::CEgOStream() {
}
void CEgOStream::PutByte( unsigned char inChar ) {
PutBlock( &inChar, 1 );
}
void CEgOStream::PutLong( long inNum ) {
unsigned long int u = inNum;
PutByte( (unsigned char) (u & 0xFF) );
u /= 0x100;
PutByte( (unsigned char) (u & 0xFF) );
u /= 0x100;
PutByte( (unsigned char) (u & 0xFF) );
PutByte( (unsigned char) (u / 0x100) );
}
void CEgOStream::PutShort( signed short int inNum ) {
unsigned short int u = inNum;
PutByte( (unsigned char) (u & 0xFF) );
PutByte( (unsigned char) (u / 0x100) );
}
void CEgOStream::Writeln( const char* inStr ) {
if ( noErr() ) {
Write( inStr );
PutByte( 13 );
//PutByte( 10 );
} // Put return
}
void CEgOStream::Writeln( const UtilStr& inStr ) {
if ( noErr() )
PutBlock( inStr.getCStr(), inStr.length() ); // Put string
Writeln();
}
void CEgOStream::Write( const char* inStr ) {
const char* s = inStr;
if ( inStr ) {
while ( *s )
s++;
PutBlock( inStr, s - inStr );
}
}
void CEgOStream::Write( const UtilStr* inData ) {
if ( inData )
PutBlock( inData -> getCStr(), inData -> length() );
}
void CEgOStream::PutBlock( const void* inSrce, long numBytes ) {
mOBuf.Append( (char*) inSrce, numBytes );
}
void CEgOStream::PutBlock( CEgIStream& inStream, long inBytes ) {
static UtilStr buf;
buf.Assign( inStream, inBytes );
if ( inStream.noErr() )
PutBlock( buf.getCStr(), inBytes );
else
throwErr( cOStreamEOfIS );
}
void CEgOStream::skip( long inBytes ) {
if ( inBytes > 0 )
PutBlock( NULL, inBytes );
}
void CEgOStream::Reset() {
mOBuf.Wipe();
throwErr( ::cNoErr );
}